home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 February (DVD) / PCWorld_2008-02_DVD.iso / v cisle / PHP / PHP.exe / xampp-win32-1.6.5-installer.exe / htdocs / xampp / iart.php < prev    next >
Encoding:
PHP Script  |  2007-12-20  |  2.8 KB  |  95 lines

  1. <?php
  2.     include "langsettings.php";
  3.  
  4.     // Copyright (C) 2002/2003 Kai Seidler <oswald@apachefriends.org>
  5.     //
  6.     // This program is free software; you can redistribute it and/or modify
  7.     // it under the terms of the GNU General Public License as published by
  8.     // the Free Software Foundation; either version 2 of the License, or
  9.     // (at your option) any later version.
  10.     //
  11.     // This program is distributed in the hope that it will be useful,
  12.     // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     // GNU General Public License for more details.
  15.     //
  16.     // You should have received a copy of the GNU General Public License
  17.     // along with this program; if not, write to the Free Software
  18.     // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20.          $text=$_REQUEST['text'];
  21.         if($text=="") $text="ceci n est pas un ami d apache";
  22.         if($_REQUEST['img']!=1)
  23.         {
  24. ?>
  25. <html>
  26.     <head>
  27.         <meta name="author" content="Kai Oswald Seidler">
  28.         <link href="xampp.css" rel="stylesheet" type="text/css">
  29.         <title></title>
  30.     </head>
  31.  
  32.     <body>
  33.          <p>
  34.         <h1><?php echo $TEXT['iart-head']; ?></h1>
  35.  
  36.         <img width="520" height="320" src="iart.php?img=1&text=<?=urlencode($text)?>" alt=""><p class="small">
  37.         <?=$TEXT['iart-text1']?><p>
  38.         <form name="ff" action="iart.php" method="get">
  39.             <input type="text" name="text" value="<?=$text?>" size="30">
  40.             <input type="submit" value="<?=$TEXT['iart-ok']?>">
  41.         </form>
  42.         <p>
  43.         <?php include("showcode.php"); ?>
  44.     </body>
  45. </html>
  46. <?php
  47.         exit;
  48.     }
  49.  
  50.     $fontfile = "./AnkeCalligraph.TTF";
  51.  
  52.     $size = 9;
  53.     $h = 320;
  54.     $w = 520;
  55.  
  56.     $im  =  ImageCreate($w, $h);
  57.  
  58.     $fill = ImageColorAllocate($im, 251, 121, 34);
  59.     $light = ImageColorAllocate($im, 255, 255, 255);
  60.     $corners = ImageColorAllocate($im, 153, 153, 102);
  61.     $dark = ImageColorAllocate($im, 51, 51 , 0);
  62.     $black = ImageColorAllocate($im , 0, 0 , 0);
  63.  
  64.     $colors[1] = ImageColorAllocate($im, 255, 255, 255);
  65.     $colors[2] = ImageColorAllocate($im, 255 * 0.95, 255 * 0.95, 255 * 0.95);
  66.     $colors[3] = ImageColorAllocate($im, 255 * 0.9, 255 * 0.9, 255 * 0.9);
  67.     $colors[4] = ImageColorAllocate($im, 255 * 0.85, 255 * 0.85, 255 * 0.85);
  68.  
  69.     header("Content-Type: image/png");
  70.  
  71.     srand(time());
  72.  
  73.     $c = 1;
  74.     $anz = 10;
  75.     $step = (4 / $anz);
  76.     for ($i = 0; $i < $anz; $i += 1) {
  77.         $size = rand(7, 70);
  78.         $x = rand(-390, 390);
  79.         $y = rand(-100, 400);
  80.         $color = $colors[$c];
  81.         $c += $step;
  82.         ImageTTFText($im, $size, 0, $x, $y, $color, $fontfile, $_GET['text']);
  83.     }
  84.  
  85.     ImageLine($im, 0, 0, $w - 1, 0, $light);
  86.     ImageLine($im, 0, 0, 0, $h - 2, $light);
  87.     ImageLine($im, $w - 1, 0, $w-1, $h, $dark);
  88.     ImageLine($im, 0, $h - 1, $w - 1, $h - 1, $dark);
  89.     ImageSetPixel($im, 0 , $h - 1, $corners);
  90.     ImageSetPixel($im, $w - 1, 0, $corners);
  91.  
  92.     ImagePNG($im);
  93.     exit;
  94. ?>
  95.